package com.example.yypt;

import java.io.UnsupportedEncodingException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

import com.example.yypt.server.DXServer;

@SpringBootApplication
@EnableScheduling
public class AppStart {
	
	@Autowired
	private DXServer server;

	public static void main(String[] args) {
		SpringApplication.run(AppStart.class, args);
		//String test="<?xml version=\"1.0\" encoding=\"gbk\" ?><response><code>03</code><message><desmobile>18459195134</desmobile><msgid>f800a7115e74b5507000</msgid></message><message><desmobile>18459195134</desmobile><msgid>f800a7115e74b5507001</msgid></message><message><desmobile>18459195134</desmobile><msgid>f800a7115e74b5507002</msgid></message></response>"; 
		//DXServer.Test(test);
	}
	@Scheduled(cron = "0/3 * * * * *")
    public void timer(){
		try {
			server.sendMsg();
		} catch (UnsupportedEncodingException e) {
			
			e.printStackTrace();
		}
	}
}
